package cheqex.dao;

import org.apache.torque.util.Criteria;

import cheqex.dao.*;


import java.util.ArrayList;
import java.util.List;

public class WeeklyRemarksPeer
    extends cheqex.dao.BaseWeeklyRemarksPeer
{
	public static boolean addRemarks(int id, String remarks){
		Criteria criteria = new Criteria();
		criteria.add(WeeklyRemarksPeer.WEEKID,id);
		criteria.add(WeeklyRemarksPeer.REMARKS,remarks);
		
		try{
			WeeklyRemarksPeer.doInsert(criteria);
			return true;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	
	public static boolean updateRemarks(int id, String remarks){
		Criteria scriteria = new Criteria();
		scriteria.add(WeeklyRemarksPeer.WEEKID,id);
		
		Criteria criteria = new Criteria();
		criteria.add(WeeklyRemarksPeer.REMARKS,remarks);
		
		try{
			WeeklyRemarksPeer.doUpdate(scriteria, criteria);
			return true;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	
	public static List<WeeklyRemarks> retrieveRemarks(int id){
		Criteria criteria = new Criteria();
		criteria.add(WeeklyRemarksPeer.WEEKID,id);
		try{
			return (List<WeeklyRemarks>)WeeklyRemarksPeer.doSelect(criteria);
		}catch(Exception e){
			e.printStackTrace();
			return new ArrayList<WeeklyRemarks>();
		}
	}
}
